
file="metaphlan_output/G{}S{}_{}.txt"

for s in (1,2):
    for g in (1,6,9):
        data = []
        with open(file.format(g,s,"metaphlan"),'r') as f:
            for line in f.readlines():
                if line[0] == "#":
                    continue
                info = line.strip().split("\t")
                trans = info[0].replace("|","\t")
                if trans.count("\t") == 7:
                    data.append(info[2] + "\t" + trans +"\n")
        with open(file.format(g,s,"krona"),'w') as f:
            f.writelines(data[::-1])